<?
include_once('../common/init.php');
include_once(DIR_CONTROL."ctl_main.php");
$objMain = new Ctl_Main($db);
//$modul = CM_getParameter(MODUL);
include_once(DIR_MODEL."md_cat_san_pham.class.php");
$objcatSanpham = new MD_CatSanpham($db);
$arrayDataCatSP0 = $objcatSanpham -> getByWhere("*","hien_thi=1 AND parent_id = 0","thu_tu asc");
//hang sx
include_once(DIR_MODEL."md_hang_sx.class.php");
$objHangsx = new MD_Hangsx($db);
$arrayDataHangsx = $objHangsx -> getByWhere("*","hien_thi = 1","thu_tu asc");
$modul = $_REQUEST['modul'];
$action = $_REQUEST['action'];

?>
<form action="?modul=sanpham&action=search_advance_text" name="frmSearch" method="post">
<input type="hidden" name="closeForm" id="closeForm" value="">

<div class="title" style="margin-left:10px; width:10px; height:30px; float:left;"></div><!-- title -->
<p style="float:left; line-height:30px; font-weight:bold; color:#FFFFFF; background: url(../images/modul_c.gif);">Tìm kiếm nâng cao</p>
<div class="title2" style="width:10px; height:30px; float:left"></div>
<div style="clear:both;"></div>
<div class="bg_l_t"><div class="bg_r_t"><div class="bg_c_t"></div></div></div>
<div class="cat_sp_cen">
<table width="100%" cellpadding="3" cellspacing="0">
	<tr>
		<td>
			Tên sản phẩm
		</td>
		<td>
			<input type="text" name="ten_sp_adv" style="width:250px; " value="<?=$_SESSION['ten_sp']?>">
		</td>
	</tr>
	<tr>
		<td>
			Loại sản phẩm
		</td>
		<td>
			<select name="loai_sp_adv" style="width:150px; ">
			<option value="0" selected>Chọn tất cả sản phẩm</option>
			<?
			foreach($arrayDataCatSP0 as $rowCatSP0){
				$idTK0 = $rowCatSP0['id'];
				$nameTK0 = $rowCatSP0['ten_loai_sp'];
			?>
				<option value="<?=$rowCatSP0['id']?>" style="font-size:12px; font-family:tahoma;" <? if($_SESSION['loai_sp_search'] == $idTK0){?> selected <? }?>>
				<?=$nameTK0?>
				</option>
			
			<?
			}//end foreach($arrayDataCatSP0 as $rowCatSP0)
			unset($arrayDataCatSP0);
			?>
			</select>			
		</td>
	</tr>
	<tr>
		<td>
			Sản phẩm
		</td>
		<td>
			<select name="sanpham_adv" style="width:150px; ">
				<option value="0"<?php echo $_SESSION["sanpham_adv"]==0?" selected":"";?>>Chọn sản phẩm</option>
				<option value="1"<?php echo $_SESSION["sanpham_adv"]==1?" selected":"";?>>Khuyến mại</option>
				<option value="2"<?php echo $_SESSION["sanpham_adv"]==2?" selected":"";?>>Sản phẩm mới</option>
				<option value="3"<?php echo $_SESSION["sanpham_adv"]==3?" selected":"";?>>Sản phẩm bán chạy</option>
			</select>
		</td>
	</tr>
	<tr>
		<td>
			Giá
		</td>
		<td>
			Từ:&nbsp;&nbsp;<input type="text" name="price_from_adv" value="<?php echo $_SESSION["price_from"];?>" style="width:85px; ">&nbsp;&nbsp;Đến:&nbsp;&nbsp;<input type="text" name="price_to_adv" value="<?php echo $_SESSION["price_to"];?>" style="width:92px; ">
			&nbsp;&nbsp;<i>(ví dụ: 1,000,000)</i>
		</td>
	</tr>
	<tr>
		<td>
			Hãng sản xuất
		</td>
		<td>
			<select name="hangsx_adv" style="width:150px; ">
			<option value="0" selected>Chọn hãng sản xuất</option>
			<?
			foreach($arrayDataHangsx as $rowHsx){
			$idHsx = $rowHsx['id'];
			?>
				<option value="<?=$rowHsx['id']?>" <? if($_SESSION['hangsx'] == $idHsx){?> selected <? }?>><?=$rowHsx['ten_hang']?></option>
			<?
			}//end foreach($arrayDataHangsx as $rowHsx)
			unset($arrayDataHangsx);
			?>
			</select>
		</td>
	</tr>
	<tr>
		<td>&nbsp;
			
		</td>
		<td align="left" style="padding-top:10px; " >
			<input type="submit" name="Submit" value="Tìm kiếm">&nbsp;
			<?
			if($modul == "home"){
			?>
			<input type="button" value="Hủy bỏ" onclick="return getSearchAdvanceClose();">
			<?
			}elseif($modul == "sanpham" || $modul == ""){
			?>
			<input type="button" value="Hủy bỏ" onclick="return getSearchAdvanceCloseSP();">
			<?
			}
			?>
		</td>
	</tr>
</table>
</div><!-- cat_sp_cen -->
<div class="bg_l_b"><div class="bg_r_b"><div class="bg_c_b"></div></div></div>
</form>